﻿using System;
using System.Xml;
using BuzzX8.Xmpp.StreamElements;

namespace BuzzX8.Xmpp.Test.StreamElements
{
    internal class StreamElementImpl : StreamElement
    {
        public StreamElementImpl(string name)
            : base(name)
        {
        }

        public StreamElementImpl(string name, string namespaceName)
            :base(name, namespaceName)
        {
        }

        public StreamElementImpl(string name, string namespaceUri, string namespaceName)
            : base(name, namespaceUri, namespaceName)
        {
        }

        public string Payload { get; set; }

        public object this[String name]
        {
            get { return Attributes[name]; }
            set { Attributes[name] = value; }
        }

        protected override void WritePayload(XmlWriter writer)
        {
            if (!string.IsNullOrEmpty(Payload)) writer.WriteString(Payload);
        }
    }
}
